<?php

/**
 * Criteriu form base class.
 *
 * @method Criteriu getObject() Returns the current form's model object
 *
 * @package    acap
 * @subpackage form
 * @author     Verminu
 */
abstract class BaseCriteriuForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'cod'          => new sfWidgetFormInputText(),
      'descriere'    => new sfWidgetFormInputText(),
      'consum_lunar' => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorChoice(array('choices' => array($this->getObject()->getId()), 'empty_value' => $this->getObject()->getId(), 'required' => false)),
      'cod'          => new sfValidatorString(array('max_length' => 16)),
      'descriere'    => new sfValidatorString(array('max_length' => 128)),
      'consum_lunar' => new sfValidatorInteger(array('min' => -128, 'max' => 127, 'required' => false)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorPropelUnique(array('model' => 'Criteriu', 'column' => array('cod')))
    );

    $this->widgetSchema->setNameFormat('criteriu[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Criteriu';
  }


}
